package com.tinem.platform.web.netty;

import com.alibaba.fastjson.JSON;
import com.auth0.jwk.Jwk;
import com.auth0.jwk.UrlJwkProvider;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.DecodedJWT;
import com.tinem.platform.module.starter.jms.annotation.EnableJms;
import com.tinem.platform.module.starter.sdk.annotation.EnableJWK;
import com.tinem.platform.web.netty.websocket.config.ServerConfiguration;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;

import java.net.URL;
import java.security.interfaces.RSAPublicKey;

/**
 * @author fengzhihao
 * @version v1
 * @program: platform
 * @className WebSocketApplication
 * @description TODO
 * @site 
 * @company 
 * @create 2020-06-19 11:19
 */
@Slf4j
@EnableJms
@EnableJWK
@SpringBootApplication
public class NettyWebApplication {
    public static ConfigurableApplicationContext applicationContext;
    public static void main(String[] args) throws Exception {
        long startTime = System.currentTimeMillis();

        SpringApplicationBuilder applicationBuilder = new SpringApplicationBuilder(NettyWebApplication.class);
        applicationBuilder.web(WebApplicationType.NONE);
        applicationContext = applicationBuilder.run(args);
        applicationContext.getBean(ServerConfiguration.class).run(args);

        long endTime = System.currentTimeMillis();
        System.out.println("start success; duration:("+ (endTime - startTime) +");startTime:("+startTime+");endTime:("+ endTime +")");
        log.info("start success; duration:({});startTime:({});endTime:({})",(endTime - startTime),startTime,endTime);

    }
}
